package core;


import gitobject.Commit;
import gitobject.Head;

import java.text.SimpleDateFormat;
import java.util.Date;

public class JitCommit {
    public static void commit(String message) throws Exception{
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = simpleDateFormat.format(new Date());
        String author = System.getProperty("user.name") + " " + time;
        String committer = System.getProperty("user.name");

        Commit commit = new Commit(author,committer,message);
        Head head = Head.deserialize();
        Commit c = Commit.deserialize(head.getKey());
        System.out.println(c.getAuthor() + " " + c.getMessage() + " " + c.getKey());

    }
}
